<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1.0">
		<title></title>
		<link href="css/index2.css" rel="stylesheet" />
	</head>
	<body>
	<div class="gray-bg">
		<div class="headTitle">
		<img onclick="goback()" src="./img/leftArrow.jpg" />
		<p>关联合肥通</p>
		<span class="addCard">添加</span>
       </div>
		<ul class="conetnt cardlist">
			<!--<li>
				<a href="cardInfo.html"><img class="cardface" src="./img/listLogo.jpg" />
				<p class="cardContent">
					<span class="cardTitle">合肥通普通卡</span>
					<span class="cardNum">8089 9999 0889 9866</span>
				</p>
				</a>
			</li>-->
			<!--<li>
				<img class="cardface" src="./img/listLogo.jpg" />
				<p class="cardContent">
					<span class="cardTitle">合肥通学生卡</span>
					<span class="cardNum">8089 9999 0889 9866</span>
				</p>
			</li>
			<li>
				<img class="cardface" src="./img/listLogo.jpg" />
				<p class="cardContent">
					<span class="cardTitle">合肥通老年卡</span>
					<span class="cardNum">8089 9999 0889 9866</span>
				</p>
			</li>-->
		</ul>
		<div class="linkageStyle" style="display: block;">
			<div class="shadow-con">
				<h5>
					请选择关联方式
					<i class="close"></i>
				</h5>
				<ul class="stylelist">
					<li class="nfcRelation">
						<a><i><img class="linkicon" src="./img/linkstyle01.png" /></i>
						<p class="cardContent">
							<span class="cardTitle">1.NFC验证关联</span>
							<span class="cardNum">NFC手机读取卡号后直接关联</span>
							<img class="rightArrow" src="./img/rightArrow.jpg" />
						</p>
                        </a>
					</li>
					<li class="idRelation">
						<i><img class="linkicon" src="./img/linkstyle02.png" /></i>
						<p class="cardContent">
							<span class="cardTitle">2.身份证查询关联</span>
							<span class="cardNum">身份证查询关联</span>
							<img class="rightArrow" src="./img/rightArrow.jpg" />
						</p>
					</li>
					<li class="searchRelation">
						<a ><i><img class="linkicon" src="./img/linkstyle03.png" /></i>
						<p class="cardContent">
							<span class="cardTitle">3.交易记录查询关联</span>
							<span class="cardNum">通过本账号交易过的卡</span>
							<img class="rightArrow" src="./img/rightArrow.jpg" />
						</p></a>
					</li>
				</ul>
			</div>
		</div>
	</div>    
<script src="js/jquery.min.js"></script>
<script src="js/oldPublic.js"></script>
<script src="js/code.js"></script>
<script src="js/security.js"></script>
<script>
	// 判断设备为 ios
	function isIos() {
	    var u = navigator.userAgent;
	    if (u.indexOf("iPhone") > -1 || u.indexOf("iOS") > -1) {
	        return true;
	    }
	    return false;
	}
	if(isIos()){ //如果是ios手机
		$('.nfcRelation').css('background','#EEEEEE');
		$('.nfcRelation').find('.rightArrow').hide();
		$('.nfcRelation').css('pointer-events','none');
	}
	$('.nfcRelation').click(function(){
		window.Android2Js.gotoNFCActivity();
	})
	var login_name = sessionStorage.getItem('login_name');
	var telphone = sessionStorage.getItem('telphone');
	var orgcode = sessionStorage.getItem('orgcode');
	var idno = sessionStorage.getItem('idno');
	var idtype = sessionStorage.getItem('idtype');
	var name = sessionStorage.getItem('name');
	
	var locationUrl = window.location.href;
//	var idno = locationUrl.split('?')[1].split('&')[0];
//	var idtype = locationUrl.split('?')[1].split('&')[1];
//	var name =  locationUrl.split('?')[1].split('&')[2];
//	idno = idno.substring(5,idno.length);
//	idtype = idtype.split('=')[1];
//	name = name.split('=')[1];

			$.ajax({
				type:"post",
				url:sessionStorage.getItem('ipconfig'),
				data:JSON.stringify({data:encryptByDESModeEBC(JSON.stringify({"tag": "9100", 'login_name': login_name, 'telphone': telphone, 'bus_type': '1','idno':'0084','idtype':'01','name':name,'orgcode':orgcode}))}),
				contentType: "application/json;charset=utf-8",
				success:function(data){
					console.log(data);
					if(data.result=='00'){
						var str ='';
						var bind_info =JSON.parse(data.bind_info);
						var cardList = {};
						for(var i=0;i<bind_info.length;i++){
							cardList.acct_type = bind_info[i].acct_type;
							cardList.acct_no = bind_info[i].acct_no;
							cardList.bind_date = bind_info[i].bind_date;
							cardList = JSON.stringify(cardList);
							str+='<li cardList = '+cardList+' onclick = "gotoCardDetial(this)">'+
									'<a><img class="cardface" src="./img/listLogo.jpg" />'+
									'<p class="cardContent">'+
										'<span class="cardTitle">'+changeType(bind_info[i].acct_type)+'</span>'+
										'<span class="cardNum">'+bind_info[i].acct_no+'</span>'+
									'</p>'+
									'</a>'+
								'</li>'
						}
						$('.cardlist').html(str);
					}
					
				}
			});
			
			
	$('.addCard').click(function(){
		$('.linkageStyle').show();
	})
	$('.nfcRelation').click(function(){
		if(isIos()){
			return false;
		}
		window.location.href = 'bindIndex.html';
	})
	$('.idRelation').click(function(){
		    window.location.href = './cardLinkage.html?&type=id';
	})
	$('.searchRelation').click(function(){
		    window.location.href = './cardLinkage.html?&type=recode';
	})
	
	$('.close').click(function(){
		$(this).parents('.linkageStyle').hide();
	})
	
	function gotoCardDetial(a){
		var cardList = $(a).attr('cardList');
		window.location.href = './cardInfo.html?cardList='+cardList;
}
	function changeType(a){
				var nameText = ''
				if(a=='001'){
					nameText = '住建部'
				}else if(a=='002'){
					nameText = 'Pboc'
				}else if(a=='003'){
					nameText = '交通部'
				}else if(a=='004'){
					nameText = '62BBIN'
				}else if(a=='005'){
					nameText = '虚拟电子卡'
				}else if(a=='006'){
					nameText = '账户系统'
				}
				return nameText
			}
</script>

</body>
</html>
